Conditions | 2 |
Total Lines | 19 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { QueryHandler } from '@nestjs/cqrs'; |
||
13 | |||
14 | public async execute({ schoolId }: GetDiscountsBySchoolQuery): Promise<DiscountView[]> { |
||
15 | const discountViews: DiscountView[] = []; |
||
16 | const discounts = await this.discountRepository.findBySchool( |
||
17 | schoolId |
||
18 | ); |
||
19 | |||
20 | for (const discount of discounts) { |
||
21 | discountViews.push( |
||
22 | new DiscountView( |
||
23 | discount.getId(), |
||
24 | discount.getType(), |
||
25 | discount.getAmount() / 100, |
||
26 | discount.getValue() / 100 |
||
27 | ) |
||
28 | ); |
||
29 | } |
||
30 | |||
31 | return discountViews; |
||
32 | } |
||
34 |